//
//  ByIndexHealthVC.m
//  jinpuyiyuan_ios
//
//  Created by pro on 2017/12/12.
//  Copyright © 2017年 mc. All rights reserved.
//

#import "ByIndexHealthVC.h"

// cell
#import "ByCellIndexHealth.h"

// vc
#import "ByIndexHealthDetailVC.h"

@interface ByIndexHealthVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *dataAry;
@end

@implementation ByIndexHealthVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"健康资讯";
    [self addLeftBackBarButtonItem];
    [self createViews];
}

#pragma mark - getter
- (NSMutableArray *)dataAry{
    if (!_dataAry) {
        _dataAry = [NSMutableArray array];
    }
    return _dataAry;
}

#pragma mark - create views
- (void)createViews{
    self.tableView = [[UITableView alloc] init];
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(0));
        make.right.equalTo(@(0));
        if (@available(iOS 11.0,*)) {
            make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
            make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
        }else{
            make.top.equalTo(self.view.mas_top);
            make.bottom.equalTo(self.view.mas_bottom);
        }
    }];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.backgroundColor = BY_TABLE_COLOR;
}

#pragma mark - UITableViewDelegate,UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
//    return self.dataAry.count;
    return 10;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ByCellIndexHealth *cell = [ByCellIndexHealth cellWithTableView:tableView];
    ByModelIndexHealth *model = [[ByModelIndexHealth alloc] init];
    model.type_from = @"1";
    cell.model = model;
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 5;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return [UIView new];
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.0001;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 60;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    ByIndexHealthDetailVC *vc = [[ByIndexHealthDetailVC alloc] init];
    [self by_normalPush:vc hasNavi:YES];
}
@end
